package com.mezz.bones.im.logic.repository.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mezz.bones.im.logic.mapper.IChatPrivateMessageInfoMapper;
import com.mezz.bones.im.logic.domain.entity.ChatPrivateMessageInfo;
import com.mezz.bones.im.logic.repository.IChatPrivateMessageInfoRepository;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * IM单聊消息-扩展信息记录表 服务实现类
 * </p>
 *
 * @author mezz
 * @since 2025-01-08
 */
@Service
public class ChatPrivateMessageInfoRepositoryImpl extends ServiceImpl<IChatPrivateMessageInfoMapper, ChatPrivateMessageInfo> implements IChatPrivateMessageInfoRepository {

    @Override
    public List<ChatPrivateMessageInfo> listByMsgKey(List<String> msgKeys) {

        if(CollUtil.isEmpty(msgKeys)){
            return new ArrayList<>();
        }

        LambdaQueryWrapper<ChatPrivateMessageInfo> q = new LambdaQueryWrapper<>();
        q.in(ChatPrivateMessageInfo::getMsgKey,msgKeys);
        return this.list(q);
    }


}
